import { _decorator, Component, Node } from 'cc';
import { CampType } from '../Common';
const { ccclass, property } = _decorator;

@ccclass('TankCamp')
export class TankCamp extends Component {

    @property
    camp:CampType=CampType.palyer;

    protected onLoad(): void {
        
    }

    canHit(target:TankCamp):boolean{
        //console.log(this.camp+":"+target.camp);
        /*
        if(!this.camp){
            console.log("Error camp fail");
        }
        */
        if(this.camp===CampType.palyer && target.camp===CampType.enemy){
            return true;
        }
        else if(this.camp===CampType.palyer &&target.camp===CampType.neutral){
            return true;
        }
        else if(this.camp===CampType.enemy &&target.camp===CampType.palyer){

            return true;
        }  else if(this.camp===CampType.enemy &&target.camp===CampType.neutral){

            return true;
        }

        return false;
    }
}


